/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_administratifvehicule")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvAdministratifvehicule.findAll", query = "SELECT c FROM CvAdministratifvehicule c"),
    @NamedQuery(name = "CvAdministratifvehicule.findByIdvehicule", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.idvehicule = :idvehicule"),
    @NamedQuery(name = "CvAdministratifvehicule.findByCvAdministratifvehiculecol", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.cvAdministratifvehiculecol = :cvAdministratifvehiculecol"),
    @NamedQuery(name = "CvAdministratifvehicule.findByPhotodeface", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.photodeface = :photodeface"),
    @NamedQuery(name = "CvAdministratifvehicule.findByPhotodedos", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.photodedos = :photodedos"),
    @NamedQuery(name = "CvAdministratifvehicule.findByPhotodeprofilgauche", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.photodeprofilgauche = :photodeprofilgauche"),
    @NamedQuery(name = "CvAdministratifvehicule.findByPhotodeprofildroit", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.photodeprofildroit = :photodeprofildroit"),
    @NamedQuery(name = "CvAdministratifvehicule.findByCartegriseDelivrance", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.cartegriseDelivrance = :cartegriseDelivrance"),
    @NamedQuery(name = "CvAdministratifvehicule.findByCartegriseExpiration", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.cartegriseExpiration = :cartegriseExpiration"),
    @NamedQuery(name = "CvAdministratifvehicule.findByCartegriseScan", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.cartegriseScan = :cartegriseScan"),
    @NamedQuery(name = "CvAdministratifvehicule.findByAssuranceCompagnie", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.assuranceCompagnie = :assuranceCompagnie"),
    @NamedQuery(name = "CvAdministratifvehicule.findByAssuranceExpiration", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.assuranceExpiration = :assuranceExpiration"),
    @NamedQuery(name = "CvAdministratifvehicule.findByAssuranceEffet", query = "SELECT c FROM CvAdministratifvehicule c WHERE c.assuranceEffet = :assuranceEffet")})
public class CvAdministratifvehicule implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idvehicule")
    private Integer idvehicule;
    @Column(name = "cv_administratifvehiculecol")
    private String cvAdministratifvehiculecol;
    @Column(name = "photodeface")
    private String photodeface;
    @Column(name = "photodedos")
    private String photodedos;
    @Column(name = "photodeprofilgauche")
    private String photodeprofilgauche;
    @Column(name = "photodeprofildroit")
    private String photodeprofildroit;
    @Column(name = "cartegrise_delivrance")
    @Temporal(TemporalType.DATE)
    private Date cartegriseDelivrance;
    @Column(name = "cartegrise_expiration")
    @Temporal(TemporalType.DATE)
    private Date cartegriseExpiration;
    @Column(name = "cartegrise_scan")
    private String cartegriseScan;
    @Column(name = "assurance_compagnie")
    private String assuranceCompagnie;
    @Column(name = "assurance_expiration")
    @Temporal(TemporalType.DATE)
    private Date assuranceExpiration;
    @Column(name = "assurance_effet")
    @Temporal(TemporalType.DATE)
    private Date assuranceEffet;
    @JoinColumn(name = "idvehicule", referencedColumnName = "idvehicule", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private CvVehicule cvVehicule;

    public CvAdministratifvehicule() {
    }

    public CvAdministratifvehicule(Integer idvehicule) {
        this.idvehicule = idvehicule;
    }

    public Integer getIdvehicule() {
        return idvehicule;
    }

    public void setIdvehicule(Integer idvehicule) {
        this.idvehicule = idvehicule;
    }

    public String getCvAdministratifvehiculecol() {
        return cvAdministratifvehiculecol;
    }

    public void setCvAdministratifvehiculecol(String cvAdministratifvehiculecol) {
        this.cvAdministratifvehiculecol = cvAdministratifvehiculecol;
    }

    public String getPhotodeface() {
        return photodeface;
    }

    public void setPhotodeface(String photodeface) {
        this.photodeface = photodeface;
    }

    public String getPhotodedos() {
        return photodedos;
    }

    public void setPhotodedos(String photodedos) {
        this.photodedos = photodedos;
    }

    public String getPhotodeprofilgauche() {
        return photodeprofilgauche;
    }

    public void setPhotodeprofilgauche(String photodeprofilgauche) {
        this.photodeprofilgauche = photodeprofilgauche;
    }

    public String getPhotodeprofildroit() {
        return photodeprofildroit;
    }

    public void setPhotodeprofildroit(String photodeprofildroit) {
        this.photodeprofildroit = photodeprofildroit;
    }

    public Date getCartegriseDelivrance() {
        return cartegriseDelivrance;
    }
    public String getCartegriseDelivranceFormatee() {
        SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
        return formater.format(cartegriseDelivrance);
    }
    
    public void setCartegriseDelivrance(Date cartegriseDelivrance) {
        this.cartegriseDelivrance = cartegriseDelivrance;
    }

    public Date getCartegriseExpiration() {
        return cartegriseExpiration;
    }
    public String getCartegriseExpirationFormatee() {
         SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
        return formater.format(cartegriseExpiration);
    }

    public void setCartegriseExpiration(Date cartegriseExpiration) {
        this.cartegriseExpiration = cartegriseExpiration;
    }

    public String getCartegriseScan() {
        return cartegriseScan;
    }

    public void setCartegriseScan(String cartegriseScan) {
        this.cartegriseScan = cartegriseScan;
    }

    public String getAssuranceCompagnie() {
        return assuranceCompagnie;
    }

    public void setAssuranceCompagnie(String assuranceCompagnie) {
        this.assuranceCompagnie = assuranceCompagnie;
    }

    public Date getAssuranceExpiration() {
        return assuranceExpiration;
    }
    public String getAssuranceExpirationFormat() {
        SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
        return formater.format(assuranceExpiration);
    }

    public void setAssuranceExpiration(Date assuranceExpiration) {
        this.assuranceExpiration = assuranceExpiration;
    }

    public Date getAssuranceEffet() {
        return assuranceEffet;
    }
    public String getAssuranceEffetFormat() {
        SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
        return formater.format(assuranceEffet);
    }

    public void setAssuranceEffet(Date assuranceEffet) {
        this.assuranceEffet = assuranceEffet;
    }

    public CvVehicule getCvVehicule() {
        return cvVehicule;
    }

    public void setCvVehicule(CvVehicule cvVehicule) {
        this.cvVehicule = cvVehicule;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idvehicule != null ? idvehicule.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvAdministratifvehicule)) {
            return false;
        }
        CvAdministratifvehicule other = (CvAdministratifvehicule) object;
        if ((this.idvehicule == null && other.idvehicule != null) || (this.idvehicule != null && !this.idvehicule.equals(other.idvehicule))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvAdministratifvehicule[ idvehicule=" + idvehicule + " ]";
    }
    
}
